USE WSTester
GO

CREATE VIEW dbo.TestView AS
	SELECT
		Id,
		Name
	FROM
		dbo.Test
	WHERE
		dbo.Test.idDeleted = 0
GO

CREATE VIEW dbo.ResultView AS
	SELECT
		dbo.Result.Id,
		dbo.Test.Name,
		dbo.Result.DateTimeStarting,
		dbo.Result.DateTimeFinishing,
		dbo.Result.ResultTesting
	FROM
		dbo.Result INNER JOIN dbo.Test 
			ON dbo.Result.Test = dbo.Test.Id
GO

CREATE VIEW dbo.QueueView AS
	SELECT
		dbo.Queue.Id,
		dbo.Test.Name,
		dbo.Queue.DateTimeQueuing,
		dbo.Queue.Status,
		dbo.Queue.RepeatAfter
	FROM
		dbo.Queue INNER JOIN dbo.Test
			ON dbo.Queue.Test = dbo.Test.Id
GO